<script type="text/javascript">
function selectSelector()
{
    var car_id = '<?php echo $car_id ?>';
    $("#car-selector").val(car_id);
}

$(function(){   
    selectSelector();

    $("#car-selector").change(function() {
        //alert('tes');
        var car_id = $(this).val();
        location.href = "<?php echo base_url() ?>FCar/<?php echo $type ?>/" + car_id;
    });

});
</script>

<div class="car-overview" style="margin-bottom:50px;margin-top:-60px;">
    <div class="col-md-3">
        Car Selector
    <select class="form-control" id="car-selector">
        <?php 
            foreach ($query_car->result() as $row) 
            {
        ?>
                <option value="<?php echo $row->car_id ?>"><?php echo $row->series_name ?></option>
        <?php
            }
        ?>
    </select>
    </div>
</div>
<?PHP 
foreach ($query->result() as $row) 
{
    if($row->style == 'Main Style')
    {
?>

<div class="car-overview block">
    <div class="container">
        <div class="item-thumb"><img src="<?php echo base_url() ?>uploads/car_overview/<?php echo $row->image ?>"></div>
        <div class="item-content">
            <div class="sub"><?php echo $row->title ?></div>
            <div class="main">
                <?php echo $row->content1 ?>
            </div>
        </div>
    </div>
</div>

<?PHP
    }
    else if($row->style == '2 Text Style')
    {
?>

<div class="car-intro" style="background: url(<?php echo base_url() ?>uploads/car_overview/<?php echo $row->image ?>) no-repeat; background-size: cover">
    <div class="row reset">
        <div class="panel-left panel-block bg-dark-op">
            <div class="caption">
                <?php echo $row->content1 ?>
            </div>
        </div>
    </div>
    <div class="row reset">
        <div class="panel-right panel-block bg-dark-op">
            <div class="caption">
                <?php echo $row->content2 ?>
            </div>
        </div>
    </div>
</div>
<?php
    }
    else if($row->style == '3 Text Style')
    {
?>
<div class="car-intro" style="background: url(<?php echo base_url() ?>uploads/car_overview/<?php echo $row->image ?>) no-repeat; background-size: cover">
    <div class="row reset">
        <div class="panel-left panel-block bg-dark-op">
            <div class="caption">
                <?php echo $row->content1 ?>
            </div>
        </div>
    </div>
    <div class="row reset">
        <div class="panel-right panel-block bg-dark-op">
            <div class="caption">
                <?php echo $row->content2 ?>
            </div>
        </div>
    </div>
    <div class="row reset">
        <div class="panel-right panel-block bg-dark-op">
            <div class="caption">
                <?php echo $row->content3 ?>
            </div>
        </div>
    </div>
</div>        
<?php
    }
    else if($row->style == '1 Text Style')
    {
?>
<div class="car-closer">
    <div class="row reset">
        <div class="panel-left panel-block">
            <div class="caption">
             <h2><?php echo $row->title ?></h2>
                <p>
                <?php echo $row->content1 ?>
                </p>
            </div>
        </div>  
        <div class="panel-right panel-block">
            <img src="<?php echo base_url() ?>uploads/car_overview/<?php echo $row->image ?>">
        </div>         
    </div>
</div>
<?php
    }
}
?>